total = 0

s = input().split()

n = int(s[0])
m = int(s[1])

for i in range(1,n):
    for j in range(i+1,n+1):
        if m % (i + j) == 0:
            print(i,j)
            total += 1

print(total)